<template>
  <div class="form-layout">
    <!--左侧导航-->
    <div class="nav-left">
      <customAnchor
        :itemList="[
          { name: 'box-base', title: '需求明细详情' },
        ]"
      />
    </div>
    <!--表单区域-->
    <div class="form-right" ref="formRight">
      <div id="box-base" class="box-title">需求明细详情</div>
      <data-view
        propViewKey="watch_demand_item"
        :propInitData="form"
        ref="childDataView"
        :propHidePageSearch="true"
        :propHideQueryButton="true"
        :propPreQueryWrapper="$newWrapper().eq('demandId', this.form.demandId)"
      />
  </div>
</div>
</template>

<script>
import customAnchor from '@/components/custom/form/customAnchor.vue'

export default {
  data() {
    return {
      form: {},
      viewData: {}
    }
  },
  methods: {
    fetchQueryWrapper(demandId) {
      let queryWrapper = this.$newWrapper()
      if (this.form.id) {
        queryWrapper.eq('demandId', this.form.id)
      } else {
        queryWrapper.ne(1, 1)
      }
      return queryWrapper
    },
  },
  created() {
    this.$emit('event-register', {
      validate: (callback) => {
        return this.$refs.editForm.validate(callback)
      },
      beforeSave: () => {
        this.$emit('data-callback', this.form)
        return true
      },
      afterMove: (formData, initData) => {
        this.form = global.utils.jsonClone(formData)
        // 设置switch 元素默认值
      },
      afterSave: () => {  },
      beforeDelete: () => {
        return true
      },
      afterDelete: () => {
      },
      beforeFlow: (flowButtonKey) => {
        return true
      },
      afterFlow: (flowButtonKey) => {
      },
      beforeClose: () => {
        return true
      }
    })
  },
  props: {
    propParent: Object,
    propInitData: Object,
    propPrimaryKey: String,
    propDictionaries: Object,
    propCurrentRow: Object,
    propViewFormData: Object,
    propReadonly: Boolean,
    propStatus: String,
    propRules: Object
  },
  components: {
    customAnchor
  },
  computed: {
  }
}
</script>

<style lang="scss" scoped>
  .container {
    width: 100%;
    height: 100%;
  }
</style>
